import 'package:json_annotation/json_annotation.dart';

part 'life_topic_list_api.g.dart';

@JsonSerializable()
class ResponseLifeTopicListApi {
  final int total;
  final List<LifeTopic>? rows;

  ResponseLifeTopicListApi(this.total, this.rows);

  factory ResponseLifeTopicListApi.fromJson(Map<String, dynamic> json) =>
      _$ResponseLifeTopicListApiFromJson(json);
}

@JsonSerializable()
class LifeTopic {
  final String id;
  final String userId;
  final int type; //帖子类型(0:官方帖子;1:用户帖子;2:品牌视频)
  final String? avatar; //用户头像地址
  final String? userNickname; //博主昵称
  final String? title;
  final String? content; // 帖子内容，可能是一串富文本。
  final String? coverImg; // 图片地址，当mediaType = 0时，作为视频封面地址，第一帧
  final String? mediaSrc; // mediaType = 1时，为图片地址类表，逗号分隔，mediaType = 0 时，为视频地址
  final int? mediaType; // 1 或者 0
  final int? views; // 被浏览次数
  final int? comments; // 评论次数
  final int? likes; // 点赞次数
  final bool? isLike; // 我是否点赞过
  final bool? isFollow; // 我是否关注过该帖子博主
  final bool? isMyTopic; // 是否是我的帖子
  final int? publishStatus; // 帖子发布状态（0=未发布，1=已发布）
  final int? checkStatus; // 审核状态 0待审核 1审核通过 2审核不通过
  final int? status; // 状态(0:启用（展示）,1:禁用（隐藏）)
  final String? createTime; // 创建时间

  factory LifeTopic.fromJson(Map<String, dynamic> json) =>
      _$LifeTopicFromJson(json);

  LifeTopic({
    required this.id,
    required this.userId,
    required this.type,
    required this.avatar,
    required this.userNickname,
    required this.title,
    required this.content,
    required this.coverImg,
    required this.mediaSrc,
    required this.mediaType,
    required this.views,
    required this.comments,
    required this.likes,
    required this.isLike,
    required this.isFollow,
    required this.isMyTopic,
    required this.publishStatus,
    required this.checkStatus,
    required this.status,
    required this.createTime,
  });
}
